package com.orange.score.activity.entry;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.orange.score.model.match.ScoreUpdate;
import java.util.List;

public class ScoreUpdateListAdapter extends PageableAdapter<ScoreUpdate>
{
  boolean editMode = false;

  public ScoreUpdateListAdapter(List<ScoreUpdate> paramList, Context paramContext)
  {
    super(paramList, paramContext);
  }

  public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
  {
    Holder localHolder;
    View localView;
    if (paramView != null)
      localHolder = (Holder)paramView.getTag();
    while (paramInt + this.startIndex >= this.list.size())
    {
      localView = null;
      return localView;
      localHolder = new Holder(this);
      paramView = LayoutInflater.from(this.context).inflate(2130903099, null);
      localHolder.deleteButton = ((Button)paramView.findViewById(2131558651));
      localHolder.updateType = ((ImageView)paramView.findViewById(2131558496));
      localHolder.leagueName = ((TextView)paramView.findViewById(2131558498));
      localHolder.matchStartTime = ((TextView)paramView.findViewById(2131558499));
      localHolder.matchMinutes = ((TextView)paramView.findViewById(2131558500));
      localHolder.homeTeamName = ((TextView)paramView.findViewById(2131558502));
      localHolder.awayTeamName = ((TextView)paramView.findViewById(2131558503));
      localHolder.homeFlag = ((TextView)paramView.findViewById(2131558653));
      localHolder.awayFlag = ((TextView)paramView.findViewById(2131558654));
      localHolder.updateDataName = ((TextView)paramView.findViewById(2131558655));
      localHolder.updateDataValue = ((TextView)paramView.findViewById(2131558656));
      paramView.setTag(localHolder);
    }
    ScoreUpdate localScoreUpdate = (ScoreUpdate)this.list.get(paramInt + this.startIndex);
    localHolder.deleteButton.setOnClickListener(new View.OnClickListener(this, localScoreUpdate)
    {
      public void onClick()
      {
        this.this$0.list.remove(this.val$scoreUpdate);
        this.this$0.updateList(this.this$0.list);
        this.this$0.notifyDataSetChanged();
      }
    });
    if (this.editMode)
    {
      localHolder.deleteButton.setVisibility(0);
      switch (localScoreUpdate.updateType)
      {
      default:
        localHolder.leagueName.setText(localScoreUpdate.leagueName);
        localHolder.leagueName.setTextColor(localScoreUpdate.leagueColor);
        localHolder.matchStartTime.setText(localScoreUpdate.date);
        localHolder.matchMinutes.setText(localScoreUpdate.minutes);
        localHolder.homeTeamName.setText(localScoreUpdate.homeTeamName);
        localHolder.awayTeamName.setText(localScoreUpdate.awayTeamName);
        switch (localScoreUpdate.homeAwayFlag)
        {
        default:
          switch (localScoreUpdate.updateType)
          {
          default:
          case 0:
          case 1:
          case 2:
          }
        case 0:
        case 1:
        case 2:
        }
      case 0:
      case 1:
      case 2:
      }
    }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          while (true)
          {
            while (true)
            {
              while (true)
              {
                while (true)
                {
                  while (true)
                  {
                    while (true)
                    {
                      while (true)
                      {
                        while (true)
                          localView = paramView;
                        localHolder.deleteButton.setVisibility(8);
                      }
                      localHolder.updateType.setImageResource(2130837651);
                      localHolder.homeFlag.setBackgroundResource(2130837654);
                      localHolder.awayFlag.setBackgroundResource(2130837654);
                      localHolder.homeFlag.setText("进球");
                      localHolder.awayFlag.setText("进球");
                    }
                    localHolder.updateType.setImageResource(2130837657);
                    localHolder.homeFlag.setBackgroundResource(2130837655);
                    localHolder.awayFlag.setBackgroundResource(2130837655);
                    localHolder.homeFlag.setText("红牌");
                    localHolder.awayFlag.setText("红牌");
                  }
                  localHolder.updateType.setImageResource(2130837659);
                  localHolder.homeFlag.setBackgroundResource(2130837656);
                  localHolder.awayFlag.setBackgroundResource(2130837656);
                  localHolder.homeFlag.setText("黄牌");
                  localHolder.awayFlag.setText("黄牌");
                }
                localHolder.homeFlag.setVisibility(0);
                localHolder.awayFlag.setVisibility(0);
              }
              localHolder.homeFlag.setVisibility(0);
              localHolder.awayFlag.setVisibility(4);
            }
            localHolder.homeFlag.setVisibility(4);
            localHolder.awayFlag.setVisibility(0);
          }
          localHolder.updateDataName.setText("比分");
          localHolder.updateDataValue.setText(localScoreUpdate.score);
          localHolder.homeFlag.setTextColor(-1);
          localHolder.awayFlag.setTextColor(-1);
        }
        localHolder.updateDataName.setText("比数");
        localHolder.updateDataValue.setText(localScoreUpdate.redCardScore);
        localHolder.homeFlag.setTextColor(-1);
        localHolder.awayFlag.setTextColor(-1);
      }
      localHolder.updateDataName.setText("比数");
      localHolder.updateDataValue.setText(localScoreUpdate.yellowCardScore);
      int i = Color.argb(255, 121, 82, 0);
      localHolder.homeFlag.setTextColor(i);
      localHolder.awayFlag.setTextColor(i);
    }
  }

  public void turnOffEditMode()
  {
    this.editMode = false;
  }

  public void turnOnEditMode()
  {
    this.editMode = true;
  }

  class Holder
  {
    TextView awayFlag;
    TextView awayTeamName;
    Button deleteButton;
    TextView homeFlag;
    TextView homeTeamName;
    TextView leagueName;
    TextView matchMinutes;
    TextView matchStartTime;
    TextView updateDataName;
    TextView updateDataValue;
    ImageView updateType;
  }
}